package com.kpiJavaTraining.bogdan.module2;

public class QuestionStringAnswer extends Question {

	private static final long serialVersionUID = -5430466961130493264L;
	private final String CorrectAnswer;
	
	public QuestionStringAnswer(String question, String CorrectAnswer) {
		super(question);
		this.CorrectAnswer = CorrectAnswer;
	}

	@Override
	public void answer(String answer){
		if( answer.equals(getCorrectAnswer())){
			setScore(1);
		}
		else this.clear();
	}

	private String getCorrectAnswer() {
		return CorrectAnswer;
	}

	@Override
	public String toString(){
		return super.toString();	
	}
}
